#include <54func.h>
void handler(int signum, siginfo_t *siginfo, void *p){ //handler要换成3参数的
    printf("signum = %d, uid = %d\n", signum, siginfo->si_uid);
}
int main(int argc, char *argv[])
{
    struct sigaction act;
    memset(&act,0,sizeof(act));
    act.sa_sigaction = handler; //step2 结构体的成员 是sa_sigaction 而不是 sa_handler
    act.sa_flags = SA_RESTART|SA_SIGINFO; // step1 加上SA_SIGINFO
    sigaction(SIGINT,&act,NULL);
    sigaction(SIGQUIT,&act,NULL);
    //while(1){
    //    sleep(1);
    //}
    char buf[4096] = {0};
    ssize_t sret = read(STDIN_FILENO,buf,sizeof(buf));
    printf("sret = %ld, buf = %s\n", sret, buf);
    return 0;
}

